const Router = require("@koa/router");

const router = new Router();

router.get("/nacosConfig", async (ctx, next) => {
  
  const { dataId } = ctx.request.query;

  if (!dataId) {
    return (ctx.body = "dataId");
  }
  // ctx.router available
  try {
    const text = await ctx.nacosClient.getConfig(dataId, "FRONT_GROUP");
    ctx.body = text;
  } catch (error) {
    ctx.body = error;
  }
});



module.exports = router;
